
#include "Str.h"

int htoi(const char *s)
{
	int n = 0;

	if( !s ) return 0;

	if( *s == '0' )
	{
		s++;
		if( *s == 'x' || *s == 'X' )s++;
	}

	while( *s )
	{
		n <<= 4;
		if( *s <= '9' )
			n |= ( *s & 0xf );
		else
			n |= ( (*s & 0xf) + 9 );
		s++;
	}
	return n;
}

int Str_Seek(const char* str, int nLen, char ch)
{
	int i = 0;
	
	for(i = 0; i < nLen; i++, str++)
	{
		if(*str == ch)
		{
			return i;
		}
	}

	return -1;
}


